<?php
namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;


class CommentController extends Controller{
	public $assign = [];

	public function index(){
		$model_comments = new \App\Model\Comments();
		$info = $model_comments->getComments();
		$this->assign['info'] = $info;
		return view('admin.comment.commentindex',$this->assign);
	}
	//查看详情
	public function details($id){
		$model_comments = new \App\Model\Comments();
		$info = $model_comments->getCommentsById($id);
		$this->assign['info'] = $info;
		return view('admin.comment.details',$this->assign);
	}
	//启用禁用 disable
	public function disable(Request $request){
		$id = $request->post('id');
		$state = $request->post('state');
		$state = ($state == '1'?'2':'1');
		$model_comments = new \App\Model\Comments();
		return $data = $model_comments->updateState($id,$state);
	}

	//删除
	public function delComment(Request $request){
		$id = $request->post('id');
		$model_comments = new \App\Model\Comments();
		$data = $model_comments->delOne($id);
	}
	
}





















?>